home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 10685 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.4 KB

  1. Path: gwen.pcug.co.uk!altheim!broldham
  2. Newsgroups: comp.lang.c
  3. Message-ID: <1242@altheim.win-uk.net>
  4. References: <1239@altheim.win-uk.net><18MAR199607594276@erich.triumf.ca>
  5. Reply-To: broldham@altheim.win-uk.net (Brian R. Oldham)
  6. From: broldham@altheim.win-uk.net (Brian R. Oldham)
  7. Date: Tue, 19 Mar 1996 08:50:30 GMT
  8. Subject: Re: Pointers to register
  9.  
  10.  
  11. In article <18MAR199607594276@erich.triumf.ca>, P.Bennett (bennett@erich.triumf.ca) writes:
  12. >In article <1239@altheim.win-uk.net>, broldham@altheim.win-uk.net (Brian R. Oldham) writes...
  13. [snip]
  14. >> 
  15. >>Bearing in mind the usual way to assign a pointer:
  16. >> 
  17. >>    ptr = &var;
  18. >> 
  19. >>is correct for objects in memory, but how do you assign a pointer
  20. >>to a register? 
  21. >
  22. >You don't - a register doesn't have a memory address.
  23. >
  24. >>The following function works: But is it right??
  25. >
  26. >>static union REGS inregs, outregs;
  27. >
  28. >>void getkey(int *scancode, char *ch) 
  29. >>{
  30. >>    inregs.h.ah = 0x00;
  31. >>    int86(KEYBD,&inregs,&outregs);
  32. >>    *scancode = outregs.h.ah;     /* ??? */
  33. >
  34. >This is not referencing a register - outregs is a union the compiler provides
  35. >to allow the user to provide the values used to set the registers before
  36. >calling int86(), or to store the return values from that function.
  37. >
  38.  
  39. OK Point taken. But it still leaves the question why my compiler
  40. (B.Turbo C/C++ v3.0) accepts the above code, but complains at: 
  41.  
  42.     scancode = &outregs.h.ah;
  43.      
  44.  
  45.  
  46. ---
  47. Brian Oldham
  48. Hucknall UK
  49. !...Gesundbrunnen
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.